###############################################################################
#
# Makefile for yum-repo-sync
#
###############################################################################
#
# This file is part of yum-repo-sync.
#
# yum-repo-sync is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# yum-repo-sync is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with yum-repo-sync.  If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################

INSTALLDIR=/usr/sbin
CONFDIR=/etc/sysconfig
VERSION=2.0
DOCDIR=/usr/share/doc/yum-repo-sync-${VERSION}

install:
	@echo "#################### STARTING ####################"

	@echo -e "\nInstalling script yum-repo-sync to ${INSTALLDIR}..."
	install --group=root --owner=root --mode=754 yum-repo-sync.sh ${INSTALLDIR}/yum-repo-sync

	@echo -e "\nInstalling config yum-repo-sync to ${CONFDIR}/}..."

	install -b --suffix=-backup --group=root --owner=root --mode=644 yum-repo-sync.conf ${CONFDIR}/yum-repo-sync

	@echo -e "\nInstalling Documentation"
	mkdir -p ${DOCDIR}
	install --mode=644 ChangeLog             ${DOCDIR}
	install --mode=644 FAQ.txt               ${DOCDIR}
	install --mode=644 gpl.txt               ${DOCDIR}
	install --mode=644 INSTALL               ${DOCDIR}
	install --mode=644 INSTALL.pt_BR.txt     ${DOCDIR}
	install --mode=644 README                ${DOCDIR}
	install --mode=644 README.config         ${DOCDIR}
	install --mode=644 README.pt_BR.txt      ${DOCDIR}
	install --mode=644 TODO                  ${DOCDIR}
	install --mode=644 yum-repo-sync.conf    ${DOCDIR}

	@echo -e "\n#################### FINISHED ####################"

uninstall:
	@echo "#####################################"
	@echo "Removing files"
	rm -rf ${INSTALLDIR}/yum-repo-sync
	rm -rf ${CONFDIR}/yum-repo-sync
	rm -rf ${DOCDIR}
	@echo "FINISHED"
	@echo "#####################################"
